import $http from '@/assets/js/http'

//查询分站列表
export function getSubstationList(name, index, size) {
    return $http.get('/manage/substation/list', {
        params: { name: name, pageIndex: index, pageSize: size }
    });
}
//查询分站列表全部(下拉)
export function getSubstationListAll(name, index, size) {
    return $http.get('/manage/substation/listAll'  
    );
}
//查看分站详情
export function getSubstationDetail(id) {
    return $http.get('/manage/substation/detail', {
        params: { cityId :id}
    });
}
//删除分站
export function postDeleteSubstation(delId) {
    return $http.post('/manage/substation/delete', {
        cityId: delId
    });
}
//新增分站
export function postAddSubstation(param) {
    return $http.post('/manage/substation/add', {
        name: param.name,
        logo: param.logo,
        contact:param.contact,
        address:param.address,
        longitude:param.longitude,
        latitude:param.latitude
    });
}
//编辑分站
export function postEditSubstation(param) {
    return $http.post('/manage/substation/update', {
        cityId:param.cityId,
        name: param.name,
        logo: param.logo,
        contact:param.contact,
        address:param.address,
        longitude:param.longitude,
        latitude:param.latitude
    });
}
//查询分站账号列表
export function getSubstationAccountList(id,name,mobile,nickName,index, size) {
    return $http.get('/manage/substation/account/list', {   
        params: {
            cityId:id, 
            userName: name, 
            mobile:mobile,
            nickName:nickName,
            pageIndex: index, 
            pageSize: size 
        }
    });
}
//删除分站账号
export function postDeleteSubstationAccount(delId) {
    return $http.post('/manage/substation/account/delete', {
        accountId: delId
    });
}
//新增分站账户
export function postAddSubstationAccount(param) {
    return $http.post('/manage/substation/account/add', {
        cityId:param.cityId,
        userName: param.userName,
        pwd: param.pwd,
        nickName:param.nickName,
        mobile:param.mobile,
    });
}
//编辑分站账户
export function postEditSubstationAccount(param) {
    return $http.post('/manage/substation/account/update', {
        accountId:param.accountId,
        cityId: param.cityId,
        userName: param.userName,
        pwd:param.pwd,
        nickName:param.nickName,
        mobile:param.mobile,
    });
}

//获取加盟申请列表
export function getSubstationJoinList(name,cityName,mobile,description,isChecked,index, size) {
    return $http.get('/manage/substationcity/list', {   
        params: {
            name:name, 
            cityName: cityName, 
            mobile:mobile,
            description:description,
            isChecked:isChecked,
            pageIndex: index, 
            pageSize: size 
        }
    });
}

//审核加盟城市操作
export function posthandlerJoin(id,isChecked) {
    return $http.post('/manage/substationcity/dealWith', {
        id: id,
        isChecked:isChecked
    });
}